<?php
//    ->header('Access-Control-Allow-Origin','*')
//    ->header('Access-Control-Allow-Credentials', 'true')
//    ->allowCrossDomain();

// 商家端路由
Route::group('mer', function () {
    Route::get('wxauth', 'merchant/login/wxAuth')->allowCrossDomain();
    Route::get('wxaccess', 'merchant/login/wxAccess')->allowCrossDomain();
    Route::get('wxlogin', 'merchant/login/wxLogin')->allowCrossDomain();
    Route::get('gatewaybind', 'merchant/login/bindGatewayUid')->allowCrossDomain();

    Route::get('product', 'merchant/product/index')->allowCrossDomain();
    Route::get('product/find/:id', 'merchant/product/find')->allowCrossDomain();
    Route::post('product/add', 'merchant/product/add')->allowCrossDomain();
    Route::post('product/edit/:id', 'merchant/product/edit')->allowCrossDomain();
    Route::get('product/findspec/:id', 'merchant/product/findSpec')->allowCrossDomain();
    Route::post('product/editspec/:id', 'merchant/product/editSpec')->allowCrossDomain();
    Route::post('product/delete/:id', 'merchant/product/delete')->allowCrossDomain();
    Route::post('product/switchstatus/:id', 'merchant/product/switchStatus')->allowCrossDomain();

    Route::get('order', 'merchant/order/index')->allowCrossDomain();
    Route::get('order/ping', 'merchant/order/ping')->allowCrossDomain();
    Route::get('order/:id', 'merchant/order/find')->allowCrossDomain();
    Route::post('delivery/:id', 'merchant/order/delivery')->allowCrossDomain();

    Route::get('user', 'merchant/user/index')->allowCrossDomain();

    Route::get('ucenter', 'merchant/ucenter/index')->allowCrossDomain();
    Route::post('ucenter/editstore', 'merchant/ucenter/editStore')->allowCrossDomain();
    Route::post('ucenter/editcoordinate', 'merchant/ucenter/editCoordinate')->allowCrossDomain();
    Route::post('ucenter/editinfo', 'merchant/ucenter/editInfo')->allowCrossDomain();
    Route::post('ucenter/changepw', 'merchant/ucenter/changePw')->allowCrossDomain();
    Route::get('ucenter/statistics', 'merchant/ucenter/statistics')->allowCrossDomain();
    Route::get('ucenter/notification', 'merchant/ucenter/notification')->allowCrossDomain();
    Route::get('ucenter/storenotice', 'merchant/ucenter/storeNotice')->allowCrossDomain(); // 新增接口
    Route::get('ucenter/storenotice/:id', 'merchant/ucenter/storeNoticeFind')->allowCrossDomain(); // 新增接口
    Route::post('ucenter/editstorenotice', 'merchant/ucenter/editStoreNotice')->allowCrossDomain(); // 新增

    Route::get('attachment', 'merchant/attachment/index')->allowCrossDomain();
    Route::post('attachment/upload', 'merchant/attachment/upload')->allowCrossDomain();
    Route::post('attachment/delete', 'merchant/attachment/delete')->allowCrossDomain();

    Route::get('category', 'merchant/category/index')->allowCrossDomain();
    Route::get('category/tree', 'merchant/category/tree')->allowCrossDomain();
    Route::post('category/add', 'merchant/category/add')->allowCrossDomain();
    Route::post('category/edit/:id', 'merchant/category/edit')->allowCrossDomain();
    Route::post('category/delete/:id', 'merchant/category/delete')->allowCrossDomain();
    Route::post('category/savesortnum', 'merchant/category/saveSortNum')->allowCrossDomain();

    Route::post('login', 'merchant/login/login')->allowCrossDomain();
    Route::post('logout', 'merchant/login/logout')->allowCrossDomain();
    Route::get('region', 'merchant/index/region')->allowCrossDomain();

})->pattern(['id' => '\d+']);

// 用户端路由
Route::group('user', function () {
    Route::get('debugcode', 'user/base/debugCode')->allowCrossDomain();
    Route::get('wxlogin', 'user/normal/wxLogin')->allowCrossDomain();
    Route::get('homedata', 'user/normal/homeData')->allowCrossDomain();

    Route::get('product/:store_id', 'user/product/index')->allowCrossDomain();
    Route::get('product/search', 'user/product/search')->allowCrossDomain();

    Route::get('ucenter', 'user/user/ucenter')->allowCrossDomain();
    Route::get('user/address', 'user/user/address')->allowCrossDomain();
    Route::post('user/saveaddress', 'user/user/saveAddress')->allowCrossDomain();
    Route::post('user/deladdress', 'user/user/delAddress')->allowCrossDomain();
    Route::get('user/profile', 'user/user/profile')->allowCrossDomain();
    Route::post('user/editprofile', 'user/user/editProfile')->allowCrossDomain();
    Route::post('user/updateprofile', 'user/user/updateProfile')->allowCrossDomain();
    Route::get('user/bill', 'user/user/userBill')->allowCrossDomain();
    Route::post('updateuserinfo', 'user/user/updateUserInfo')->allowCrossDomain();

    Route::get('order', 'user/order/index')->allowCrossDomain();
    Route::get('order/info/:sn', 'user/order/info')->allowCrossDomain();
    Route::post('order/cancel/:id', 'user/order/cancel')->allowCrossDomain();
    Route::post('order/receipt/:id', 'user/order/receipt')->allowCrossDomain();
    Route::post('order/evaluate/:id', 'user/order/evaluate')->allowCrossDomain();
    Route::post('order/payinfo', 'user/order/payinfo')->allowCrossDomain();
    Route::post('order/confirm', 'user/order/confirm')->allowCrossDomain();
    Route::post('order/makeorder', 'user/order/makeOrder')->allowCrossDomain();

//    Route::get('checkcode', 'user/store/checkCode')->allowCrossDomain();
    Route::get('store/info/:id', 'user/store/info')->allowCrossDomain();
//    Route::get('store/banner', 'user/store/banner')->allowCrossDomain();
    Route::get('store/nearby', 'user/store/nearby')->allowCrossDomain();
    Route::get('store/notifications', 'user/store/notifications')->allowCrossDomain();
    Route::get('store/notification/:id', 'user/store/notification')->allowCrossDomain();
    Route::get('store/popupnotice', 'user/store/popupNotice')->allowCrossDomain();

})->pattern(['id' => '\d+']);

return [
];
